<template>
  <div class="q-pa-md" style="max-width: 300px">
    <div class="q-gutter-md">
      <t-badge color="secondary" multi-line> Model: "{{ model }}" </t-badge>

      <t-select
        filled
        v-model="model"
        :options="options"
        label="Multi with toggle"
        multiple
        emit-value
        map-options
      >
        <template v-slot:option="{ itemProps, opt, selected, toggleOption }">
          <t-item v-bind="itemProps">
            <t-item-section>
              <t-item-label v-html="opt.label" />
            </t-item-section>
            <t-item-section side>
              <t-toggle
                :model-value="selected"
                @update:model-value="toggleOption(opt)"
              />
            </t-item-section>
          </t-item>
        </template>
      </t-select>
    </div>
  </div>
</template>

<script>
  import { ref } from 'vue';

  export default {
    setup() {
      return {
        model: ref([]),

        options: [
          {
            label: 'Google',
            value: 1,
          },
          {
            label: 'Facebook',
            value: 2,
          },
          {
            label: 'Twitter',
            value: 3,
          },
          {
            label: 'Apple',
            value: 4,
          },
          {
            label: 'Oracle',
            value: 5,
          },
        ],
      };
    },
  };
</script>
